<?php

class MonthlyChart extends Controller {
    function MonthlyChart() {
        parent::Controller();
        $this->load->model(array('mod_chart'));
    }

    //========================function for load page master====================//

    function index() {
        if($this->check_session()){
        $this->load->view('master');
        }else{
            redirect('admin/');
            exit();
        }
    }

    //========================this is function for loading page master===========//

    function manager() {
		if($this->check_session()){
			//$data['select_data'] = $this->mod_user->selectuser();
			$data['title'] = 'Monthly Chart';
			//public
			for($i=1;$i<=12;$i++){
				$data['results'.$i]=$this->mod_chart->getMonthlyPub($i,date('Y'));
			}
			
			//private
			for($i=1;$i<=12;$i++){
				$data['resultsPri'.$i]=$this->mod_chart->getMonthlyPri($i,date('Y'));
			}
			//product
			for($i=1;$i<=12;$i++){
				$data['resultsPro'.$i]=$this->mod_chart->getMonthlyPro($i,date('Y'));
			}
			
			$this->load->view('master', $data);
        }else{
            redirect('admin/');
            exit();
        }
    }

    

//===========================function  is the end of  used for delete data from tbl_user========================//
    
     //========this is function for using checking session=============
    
     public function check_session() {
        if ($this->session->userdata('use_username')) {
            return true;
        } else {
            return false;
        }
    }
}